#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__autho__ = "Tony.Don"
__lastupdatetime__ = "2017/09/21"

'''
class\r\n
    core.event.eventmanager\r\n
description\r\n
    事件管理\r\n
attribute\r\n
    private __eventList__\r\n
        type:dict()\r\n
        description:事件列表\r\n
'''
class eventmanager():
    __eventList__ = dict({"e":None})

    def __init__(self):pass

    def addlisten(self,event,handle):
        '''
        Feature\r\n
            addlisten(self,event,handle)\r\n
        Description\r\n
            增加事件监听\r\n
        Args\r\n
            event\r\n
                type:string\r\n
                description:事件名\r\n
            handle\r\n
                type:callback\r\n
                description:事件触发时需要执行的代码\r\n
        '''
        self.__eventList__.update({event:handle})

    def triggerevent(self,event):
        '''
        Feature\r\n
            triggerevent(self,event)\r\n
        Description\r\n
            事件触发\r\n
        Args\r\n
            event\r\n
                type:string\r\n
                description:事件名\r\n
        '''
        handle = self.__eventList__.get(event)
        if handle:
            return handle
        return None
